/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.securityrat.controller_temp;

import com.securityrat.entities_temp.System;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author p.vivoli
 */
@Stateless
public class SystemFacade extends AbstractFacade<System> {
    @PersistenceContext(unitName = "SecurityRATEngine-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public SystemFacade() {
        super(System.class);
    }

    @Override
    public List<System> findAll() {
        em.clear();
        List<System> l = super.findAll(); 
        
        for (System s : l) {
            em.refresh((System)s);   // cache refresh 
        }
        //em.refresh(l);
        
        return(l);
    }
    
    
    
}
